import http from '../../utils/request/request'
export function getcompanyprofile(data) {
    return http({
        url: 'RightsManagement/companyprofile',
        method: 'get',
        params: data
    })
}


export function getUserRole(){
    return http({
        url:'/authority/user/permission',
        method:'get'
    })
}

//获取所有角色
export function getAllRole(){
    return http({
        url: '/authority/role',
        method: 'get',
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}

//分页获取角色
export function getAllRoleByPage(size, page){
    return http({
        url: `/authority/role/${page}/${size}`,
        method: 'get',
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}

//增加角色
export function addRole(data){
    return http({
        url: `/authority/role`,
        method: 'post',
        data,
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}

// 根据 ID删除角色
export function deleteRole(id){
    return http({
        url: `/authority/role/${id}`,
        method: 'delete',
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}

// 根据 角色ID分配权限
export function editRole(data){
    return http({
        url: `/authority/role`,
        method: 'put',
        data,
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}

//根据员工ID修改其角色， 一个员工可拥有多个角色
export function editEmployeeRole(id,data){
    return http({
        url: `/authority/role/${id}`,
        method: 'put',
        data,
        headers: {'X-Custom-Header': localStorage.getItem("Ip")}
    })
}